package NETWORK;

import java.io.IOException;
import java.util.HashMap;


public class TcpDictServer extends TcpServer{
    HashMap<String,String> map = new HashMap<>();

    public TcpDictServer(int port) throws IOException {
        super(port);
        map.put("cat","小猫");
        map.put("dog","小狗");
        map.put("pig","猪猪");
    }

    @Override
    public String process(String request) {
        return map.getOrDefault(request,"还没有记录到词典中");
    }

    public static void main(String[] args) throws IOException {
        TcpDictServer tcpDictServer = new TcpDictServer(8000);
        tcpDictServer.start();
    }
}
